package ThreadDemo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-09-17
 * Time: 13:54
 */
public class ThreadDemo9 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            for(int i=0;i<3;i++){
                System.out.println("Hello New Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        t.start();
        Thread.sleep(5000);
        System.out.println("join 之前");
        t.join();//阻塞等待join线程
        System.out.println("join 之后");
    }
}
